﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace QuanLyThuNgan
{
    public class NguoiDungDAO
    {

        System.Data.SqlClient.SqlConnection cn;
        public NguoiDungDAO()
        {
          if (cn == null) cn=Uit.it_Conn.getConnect(DonVi_Khac.ConnectS5);
        }

        public DataTable selectAll()
        {
            string sql = string.Format("exec dbo.usp_ThuNgan_PhanQuyen_NguoiDung_SelectAll");
            return Uit.it_SQL.getDataTable(sql,null,"");
        }
        public DataTable SelectAll_kohoatdong()
        {
            // 
            string _sql = string.Format("exec dbo.usp_ThuNgan_PhanQuyen_NguoiDung_SelectAll_kohoatdong");
            return Uit.it_SQL.getDataTable(_sql);
        }

        public DataTable selectMaNhanVien_NguoiDung()
        {
            string sql = string.Format("dbo.usp_PhanQuyen_LoadNguoiDung");
            return Uit.it_SQL.getDataTable(sql,cn);
        }
        public object selectIDNguoiDung_MaNV(string maNV)
        {
            string sql = string.Format("exec ufn_PhanQuyen_IDNguoiDung_MaNV '{0}'",maNV);
            return Uit.it_SQL.ExecuteScalar(sql,null);
        }
        public DataTable TrangThaiCaThuNgan_Nhap_XacNhan(int idnguoidung)
        {
            string sql = string.Format("exec dbo.usp_ThuNgan_ThongTin_TheoIDNguoiDung {0}", idnguoidung);
            return Uit.it_SQL.getDataTable(sql);
        }
    
    }
}
